const db = require('./config/db');

async function test() {
  try {
    console.log('测试1: 使用占位符');
    const sql1 = 'SELECT * FROM jd_users LIMIT ? OFFSET ?';
    const [result1] = await db.execute(sql1, [10, 0]);
    console.log('成功！查询到', result1.length, '条记录');
  } catch (error) {
    console.error('失败:', error.message);
  }

  try {
    console.log('\n测试2: 直接拼接');
    const sql2 = 'SELECT * FROM jd_users LIMIT 10 OFFSET 0';
    const [result2] = await db.execute(sql2, []);
    console.log('成功！查询到', result2.length, '条记录');
  } catch (error) {
    console.error('失败:', error.message);
  }

  process.exit(0);
}

test();

